/**
 * 督查小组服务层
 */
package net.huashitong.synthetical.jobOversee.Service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.synthetical.jobOversee.dao.JobGroupDao;
import net.huashitong.synthetical.jobOversee.entity.JobGroup;
import net.huashitong.synthetical.jobOversee.filter.JobGroupFilter;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class JobGroupService extends StringPKService<JobGroup> {
    @Autowired
    private JobGroupDao dao;
    @Autowired
    private SysTableService sysTableService;

    @Override
    protected BaseDao<JobGroup, String> getDao() {
        return dao;
    }

    /**
     * 查询所有督查组
     * @param filter
     * @return
     */
    public List<JobGroup> getJobGroup(JobGroupFilter filter)
    {
        return dao.getJobInfo(filter);
    }


    @Override
    protected void beforeSave(JobGroup obj) {
        obj.setSysId(sysTableService.updateMaxSysId("t_jobgroup",null));
    }



    //保存督察小组
    public void saveGroup(JobGroupFilter filter){
        JobGroup  jg  = new JobGroup();
        BeanUtils.copyProperties(filter,jg);
        save(jg);

    }


}
